import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

public class Boss extends Actor
{
   
    private EnergyBall Ball;
    public EnergyBall2 Ball2;
    private int numGolpes=30;
    int cont=0;
    int mov=0;
    
    public void act() 
    {
        int i;
        World w=(Stage)getWorld(); 
        
          movimiento();
        Actor ryF =getOneIntersectingObject(ryuF.class);
        if(ryF!=null)
        {
          ryuF ryu1 = (ryuF) ryF;
          if(ryu1.revidas() >0)           
            ryu1.bajavidas();           
        }
    }    
    
    
    public void objectLimit()
    {
        World w=getWorld();
        if(w.numberOfObjects()==3)
        {
            w.removeObject(Ball);
            w.removeObject(Ball2);
        }
    }
    public void movimiento()
    {               
        World w=getWorld();
        
        cont++;
        
        switch(cont)
        {
            case 100: w.addObject(new EnergyBall2(), getX()-60, getY()-30);
                    break;
            case 200: w.addObject(new EnergyBall2(), getX()-60, getY()+200);
                     cont=0;
                    break;
        }
        
    }
    
    public int regresaDano()
    {
      return(numGolpes);
    }  
    
    public void dano()
    {
        numGolpes--;
    }
    
    public void PosGolpe()
    {
        setLocation(getX(),getY());
    }
    
    public void PosPatada()
    {
        setLocation(getX(),getY());
    }
}